<!DOCTYPE html>
<html lang="en" class="js csstransforms3d">

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
  <meta name="generator" content="Hugo 0.85.0" />
  <meta name="description" content="">


  <link rel="shortcut icon" href="../images/favicon.png" type="image/x-icon" />
  <link rel="icon" href="../images/favicon.png" type="image/x-icon" />

  <title>Trace Logger :: Mesen Documentation</title>


  <link href="../css/nucleus.css?1626403088" rel="stylesheet">
  <link href="../css/font-awesome.min.css?1626403088" rel="stylesheet">
  <link href="../css/hybrid.css?1626403088" rel="stylesheet">
  <link href="../css/featherlight.min.css?1626403088" rel="stylesheet">
  <link href="../css/perfect-scrollbar.min.css?1626403088" rel="stylesheet">
  <link href="../css/horsey.css?1626403088" rel="stylesheet">
  <link href="../css/theme.css?1626403088" rel="stylesheet">
  <link href="../css/hugo-theme.css?1626403088" rel="stylesheet">
  <link href="../css/custom.css?1626403088" rel="stylesheet">

  <link href="../css/theme-green.css?1626403088" rel="stylesheet">


  <script src="../js/jquery-2.x.min.js?1626403088"></script>

  <style type="text/css">
    :root #header+#content>#left>#rlblock_left {
      display: none !important;
    }
  </style>

</head>

<body class="" data-url="../debugging/tracelogger.html">
  <nav id="sidebar" class="">



    <div id="header-wrapper">
      <div id="header">
        <a id="logo" href="../index.html">
          <img src="../images/MesenIcon.png" />
        </a>

      </div>

      <div class="searchbox">
        <label for="search-by"><i class="fa fa-search"></i></label>
        <input data-search-input id="search-by" type="text" placeholder="Search...">
        <span data-search-clear=""><i class="fa fa-close"></i></span>
      </div>

      <script type="text/javascript" src="../js/lunr.min.js?1626403088"></script>
      <script type="text/javascript" src="../js/horsey.js?1626403088"></script>
      <script type="text/javascript">

        var baseurl = "";


      </script>
      <script type="text/javascript" src="../js/searchjson.js?1626403088"></script>
      <script type="text/javascript" src="../js/search.js?1626403088"></script>


    </div>

    <div class="highlightable">
      <ul class="topics">








        <li data-nav-id="/gettingstarted.html" title="Getting Started" class="dd-item 
        
        
        
        ">
          <a href="../gettingstarted.html">
            Getting Started

          </a>


        </li>










        <li data-nav-id="/configuration.html" title="Configuration" class="dd-item 
        
        
        
        ">
          <a href="../configuration.html">
            Configuration

          </a>


          <ul>













            <li data-nav-id="/configuration/audio.html" title="Audio Options" class="dd-item ">
              <a href="../configuration/audio.html">
                Audio Options

              </a>
            </li>













            <li data-nav-id="/configuration/input.html" title="Input Options" class="dd-item ">
              <a href="../configuration/input.html">
                Input Options

              </a>
            </li>













            <li data-nav-id="/configuration/video.html" title="Video Options" class="dd-item ">
              <a href="../configuration/video.html">
                Video Options

              </a>
            </li>













            <li data-nav-id="/configuration/emulation.html" title="Emulation Options" class="dd-item ">
              <a href="../configuration/emulation.html">
                Emulation Options

              </a>
            </li>













            <li data-nav-id="/configuration/preferences.html" title="Preferences" class="dd-item ">
              <a href="../configuration/preferences.html">
                Preferences

              </a>
            </li>







          </ul>

        </li>










        <li data-nav-id="/tools.html" title="Tools" class="dd-item 
        
        
        
        ">
          <a href="../tools.html">
            Tools

          </a>


        </li>










        <li data-nav-id="/debugging.html" title="Debugging Tools" class="dd-item 
        parent
        
        
        ">
          <a href="../debugging.html">
            Debugging Tools

          </a>


          <ul>













            <li data-nav-id="/debugging/debugger.html" title="Debugger" class="dd-item ">
              <a href="../debugging/debugger.html">
                Debugger

              </a>
            </li>













            <li data-nav-id="/debugging/apuviewer.html" title="APU Viewer" class="dd-item ">
              <a href="../debugging/apuviewer.html">
                APU Viewer

              </a>
            </li>













            <li data-nav-id="/debugging/assembler.html" title="Assembler" class="dd-item ">
              <a href="../debugging/assembler.html">
                Assembler

              </a>
            </li>













            <li data-nav-id="/debugging/eventviewer.html" title="Event Viewer" class="dd-item ">
              <a href="../debugging/eventviewer.html">
                Event Viewer

              </a>
            </li>













            <li data-nav-id="/debugging/memorytools.html" title="Memory Tools" class="dd-item ">
              <a href="../debugging/memorytools.html">
                Memory Tools

              </a>
            </li>













            <li data-nav-id="/debugging/performanceprofiler.html" title="Performance Profiler" class="dd-item ">
              <a href="../debugging/performanceprofiler.html">
                Performance Profiler

              </a>
            </li>













            <li data-nav-id="/debugging/ppuviewer.html" title="PPU Viewer" class="dd-item ">
              <a href="../debugging/ppuviewer.html">
                PPU Viewer

              </a>
            </li>













            <li data-nav-id="/debugging/scriptwindow.html" title="Script Window" class="dd-item ">
              <a href="../debugging/scriptwindow.html">
                Script Window

              </a>
            </li>













            <li data-nav-id="/debugging/texthooker.html" title="Text Hooker" class="dd-item ">
              <a href="../debugging/texthooker.html">
                Text Hooker

              </a>
            </li>













            <li data-nav-id="/debugging/tracelogger.html" title="Trace Logger" class="dd-item active">
              <a href="../debugging/tracelogger.html">
                Trace Logger

              </a>
            </li>













            <li data-nav-id="/debugging/debuggerintegration.html" title="Integration with compilers" class="dd-item ">
              <a href="../debugging/debuggerintegration.html">
                Integration with compilers

              </a>
            </li>







          </ul>

        </li>










        <li data-nav-id="/hdpacks.html" title="HD Packs" class="dd-item 
        
        
        
        ">
          <a href="../hdpacks.html">
            HD Packs

          </a>


        </li>










        <li data-nav-id="/apireference.html" title="Lua API reference" class="dd-item 
        
        
        
        ">
          <a href="../apireference.html">
            Lua API reference

          </a>


          <ul>













            <li data-nav-id="/apireference/changelog.html" title="Changelog" class="dd-item ">
              <a href="../apireference/changelog.html">
                Changelog

              </a>
            </li>













            <li data-nav-id="/apireference/callbacks.html" title="Callbacks" class="dd-item ">
              <a href="../apireference/callbacks.html">
                Callbacks

              </a>
            </li>













            <li data-nav-id="/apireference/drawing.html" title="Drawing" class="dd-item ">
              <a href="../apireference/drawing.html">
                Drawing

              </a>
            </li>













            <li data-nav-id="/apireference/emulation.html" title="Emulation" class="dd-item ">
              <a href="../apireference/emulation.html">
                Emulation

              </a>
            </li>













            <li data-nav-id="/apireference/input.html" title="Input" class="dd-item ">
              <a href="../apireference/input.html">
                Input

              </a>
            </li>













            <li data-nav-id="/apireference/logging.html" title="Logging" class="dd-item ">
              <a href="../apireference/logging.html">
                Logging

              </a>
            </li>













            <li data-nav-id="/apireference/memoryaccess.html" title="Memory Access" class="dd-item ">
              <a href="../apireference/memoryaccess.html">
                Memory Access

              </a>
            </li>













            <li data-nav-id="/apireference/misc.html" title="Miscellaneous" class="dd-item ">
              <a href="../apireference/misc.html">
                Miscellaneous

              </a>
            </li>













            <li data-nav-id="/apireference/enums.html" title="Enums" class="dd-item ">
              <a href="../apireference/enums.html">
                Enums

              </a>
            </li>







          </ul>

        </li>





      </ul>



      <section id="shortcuts">
        <h3>More</h3>
        <ul>

          <li class="" role="">
            <a class="padding" href="https://www.mesen.ca"><img style='vertical-align: middle'
                src='../images/favicon.png' /> <span style='display: inline;vertical-align: middle'>Website</span></a>
          </li>

          <li class="" role="">
            <a class="padding" href="https://github.com/SourMesen/Mesen"><i class='fa fa-github'></i> GitHub</a>
          </li>

        </ul>
      </section>



      <div id="menuspacer"></div>
      <section id="footer">
        <div class="menuFooter">
          <div class="donateButton"><a href="https://www.mesen.ca/Donate.php"><img src="../images/patreon.png"
                alt="Become a Patron!" width="66%" height="66%"></a></div>
          <div class="donateButton"><a class="bmc-button" target="_blank" href="https://www.mesen.ca/BuyCoffee.php"><img
                src="../images/BMC-btn-logo.svg" alt="Donate"><span style="margin-left:5px">Donate</span></a></div>
          Version: <b>0.9.9</b><br />
          Last Updated: <b>2021-07-16</b>
        </div>

      </section>
    </div>
  </nav>





  <section id="body">
    <div id="overlay"></div>
    <div class="padding highlightable sticky-parent">

      <div class="sticky-spacer">
        <div id="top-bar">


          <div id="breadcrumbs" itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb">
            <span id="sidebar-toggle-span">
              <a href="#" id="sidebar-toggle" data-sidebar-toggle="">
                <i class="fa fa-bars"></i>
              </a>
            </span>

            <span id="toc-menu"><i class="fa fa-list-alt"></i></span>

            <span class="links">











              <a href='../'>Home</a> > <a href='../debugging.html'>Debugging Tools</a> > Trace Logger






            </span>
          </div>

          <div class="progress">
            <div class="wrapper">
              <nav id="TableOfContents">
                <ul>
                  <li>
                    <ul>
                      <li><a href="#basic-information">Basic Information</a></li>
                      <li><a href="#display-options">Display Options</a></li>
                      <li><a href="#custom-formatting">Custom Formatting</a></li>
                      <li><a href="#conditional-logging">Conditional Logging</a></li>
                    </ul>
                  </li>
                </ul>
              </nav>
            </div>
          </div>


        </div>
      </div>



      <div id="body-inner">

        <h1>Trace Logger</h1>






        <div class="toc">
          <div>
            <nav id="TableOfContents">
              <ul>
                <li>
                  <ul>
                    <li><a href="#basic-information">Basic Information</a></li>
                    <li><a href="#display-options">Display Options</a></li>
                    <li><a href="#custom-formatting">Custom Formatting</a></li>
                    <li><a href="#conditional-logging">Conditional Logging</a></li>
                  </ul>
                </li>
              </ul>
            </nav>
          </div>
        </div>
        <div class="imgBox">
          <div><img src="../images/TraceLogger.png">
            <span>Trace Logger</span>
          </div>
        </div>


        <!-- raw HTML omitted -->
        <h3 id="basic-information">基础信息 Basic Information</h3>
        <p>追踪器显示了CPU的执行日志,可以显示最近3w条指令的执行,另外可以将日志导出到文件中,点击`Start Logging`既可,文件会快速增大,因此建议记录短时间的用来调试 <br> The trace logger
          displays the execution log of the CPU. It can display the last 30,000 CPU instructions
          executed. Additionally, it is also possible to log these instructions to the disk by using the
          <code>Start Logging</code> button. Log files can rapidly grow in size (to several GBs worth of data in a few
          seconds), so it is recommended to log for the shortest amount of time needed.
        </p>
        <h3 id="display-options">显示选项 Display Options</h3>
        <p>多个选项可以用来控制需要显示的元素<br>A number of options that toggle the display of several elements exist:<br>
          <code>Registers</code>,
          <code>CPU Cycles</code>, <code>PPU Cycles</code>, <code>PPU Scanline</code>,
          <code>Show Effective Addresses</code>, <code>Byte Code</code>, <code>Frame Count</code>,
          <code>Additional Information (IRQ, NMI, etc.)</code>. <br>Adjust these based on your needs.
        </p>
        <p>另外还可以修改下面内容的显示内容 Additionally, you can alter the way some elements are displayed:</p>
        <ul>
          <li><strong>Status Flag Format</strong>: Offers a number of different ways to display the CPU&rsquo;s status
            flags.</li>
          <li><strong>Indent code based on stack pointer</strong>: When enabled, the log&rsquo;s lines will be indented
            by 1 character for every byte pushed to the stack. This is useful to quickly be able to identify function
            calls, for example.</li>
          <li><strong>Use Labels</strong>: When enabled, addresses that match known labels will be replaced by their
            label instead.</li>
        </ul>
        <h3 id="custom-formatting">自定义格式 Custom Formatting</h3>
        <p>The trace logger&rsquo;s output can be customized by enabling the <strong>Format Override</strong> option and
          editing the format string.
          The following tags can be used to customize the format:</p>
        <div class="highlight">
          <pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-text" data-lang="text">[ByteCode]: The byte code for the instruction (1 to 3 bytes).
[Disassembly]: The disassembly for the current instruction.
[EffectiveAddress]: The effective address used for indirect addressing modes.
[MemoryValue]: The value stored at the memory location referred to by the instruction.
[PC]: Program Counter
[A]: A register
[X]: X register
[Y]: Y register
[SP]: Stack Pointer
[P]: Processor Flags
[Cycle]: The current PPU cycle.
[Scanline]: The current PPU scanline.
[FrameCount]: The current PPU frame.
[CycleCount]: The current CPU cycle (64-bit unsigned value, resets to 0 at power on)
</code></pre>
        </div>
        <p>You can also specify some options by using a comma. e.g:</p>
        <div class="highlight">
          <pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-text" data-lang="text">[Cycle,3] will display the cycle and pad out the output to always be 3 characters wide.
[Scanline,h] will display the scanline in hexadecimal.
[Align,50]: Align is a special tag that is useful when trying to align some content. [Align,50] will make the next tag start on column 50.
</code></pre>
        </div>
        <h3 id="conditional-logging">根据条件输出 Conditional Logging</h3>
        <p>The <code>Condition</code> field accepts conditional statements in the same format as <a
            href="../debugging/debugger.html#breakpoint-configuration">breakpoints</a>.</p>
        <p>When a condition is entered, only instructions that match the given condition will be logged. This can be
          used, for example, to log cartridge register writes (e.g:
          <code>IsWrite &amp;&amp; Address &gt;= $8000</code>), PPU register reads (e.g:
          <code>IsRead &amp;&amp; Address &gt;= $2000 &amp;&amp; Address &lt;= $3FFF</code>) or when a specific portion
          of CPU memory is being executed (e.g: <code>pc &gt;= $8100 &amp;&amp; pc &lt;= $8150</code>).<br>
          Conditions are very flexible and can be used to check just about any condition &ndash; use them to your
          advantage.
        </p>


        <footer class=" footline">

        </footer>



      </div>
    </div>

    <div id="navigation">

















































































































































































































































































































































































































































































































































      <a class="nav nav-prev" href="../debugging/texthooker.html" title="Text Hooker"> <i
          class="fa fa-chevron-left"></i></a>


      <a class="nav nav-next" href="../debugging/debuggerintegration.html" title="Integration with compilers"
        style="margin-right: 0px;"><i class="fa fa-chevron-right"></i></a>

    </div>

  </section>

  <div
    style="left: -1000px; overflow: scroll; position: absolute; top: -1000px; border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;">
    <div style="border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;"></div>
  </div>
  <script src="../js/clipboard.min.js?1626403088"></script>
  <script src="../js/perfect-scrollbar.min.js?1626403088"></script>
  <script src="../js/perfect-scrollbar.jquery.min.js?1626403088"></script>
  <script src="../js/jquery.sticky-kit.min.js?1626403088"></script>
  <script src="../js/featherlight.min.js?1626403088"></script>
  <script src="../js/html5shiv-printshiv.min.js?1626403088"></script>
  <script src="../js/highlight.pack.js?1626403088"></script>
  <script>hljs.initHighlightingOnLoad();</script>
  <script src="../js/modernizr.custom.71422.js?1626403088"></script>
  <script src="../js/learn.js?1626403088"></script>
  <script src="../js/hugo-learn.js?1626403088"></script>

  <link href="../mermaid/mermaid.css?1626403088" type="text/css" rel="stylesheet" />
  <script src="../mermaid/mermaid.js?1626403088"></script>
  <script>
    mermaid.initialize({ startOnLoad: true });
  </script>


</body>

</html>